
# images=(kube-proxy-amd64:v1.11.0
#         kube-scheduler-amd64:v1.11.0
#         kube-controller-manager-amd64:v1.11.0
#         kube-apiserver-amd64:v1.11.0
#         etcd-amd64:3.2.18
#         coredns:1.1.3
#         pause-amd64:3.1
#         pause:3.1
#         kubernetes-dashboard-amd64:v1.8.3
#         k8s-dns-sidecar-amd64:1.14.8
#         k8s-dns-kube-dns-amd64:1.14.8
#         k8s-dns-dnsmasq-nanny-amd64:1.14.8 )

##!/bin/bash
# sudo docker pull k8s.gcr.io/kube-controller-manager-amd64:v1.11.2
# sudo docker pull k8s.gcr.io/kube-proxy-amd64:v1.11.2
# sudo docker pull k8s.gcr.io/kube-apiserver-amd64:v1.11.2
# sudo docker pull k8s.gcr.io/kube-scheduler-amd64:v1.11.2
# sudo docker pull k8s.gcr.io/kube-proxy-amd64:v1.11.0
# sudo docker pull k8s.gcr.io/kube-controller-manager-amd64:v1.11.0
# sudo docker pull k8s.gcr.io/kube-scheduler-amd64:v1.11.0
# sudo docker pull k8s.gcr.io/kube-apiserver-amd64:v1.11.0
# sudo docker pull k8s.gcr.io/coredns:1.1.3  
# sudo docker pull k8s.gcr.io/etcd-amd64:3.2.18 
# sudo docker pull k8s.gcr.io/pause:3.1    
# sudo docker pull quay.io/coreos/flannel:v0.10.0-amd64

images=(k8s.gcr.io/kube-proxy-amd64:v1.11.2
	k8s.gcr.io/kube-apiserver-amd64:v1.11.2
	k8s.gcr.io/kube-controller-manager-amd64:v1.11.2
	k8s.gcr.io/kube-scheduler-amd64:v1.11.2
	k8s.gcr.io/kube-apiserver-amd64:v1.11.0
	k8s.gcr.io/kube-proxy-amd64:v1.11.0
	k8s.gcr.io/kube-controller-manager-amd64:v1.11.0
	k8s.gcr.io/kube-scheduler-amd64:v1.11.0
	k8s.gcr.io/coredns:1.1.3
	k8s.gcr.io/etcd-amd64:3.2.18
	quay.io/coreos/flannel:v0.10.0-amd64
	k8s.gcr.io/pause:3.1)



REGISTRY_ALIYUNCS=registry.cn-hangzhou.aliyuncs.com
NAME_SPACE=k8s-gcr-io-jxm

pull_and_rename()
{
	echo "docker pull ${REGISTRY_ALIYUNCS}/${NAME_SPACE}/$1"
	sudo docker pull ${REGISTRY_ALIYUNCS}/${NAME_SPACE}/$1

	echo "docker tag  ${REGISTRY_ALIYUNCS}/${NAME_SPACE}/$1 $2"
	sudo docker tag  ${REGISTRY_ALIYUNCS}/${NAME_SPACE}/$1 $2

	echo "docker rmi  ${REGISTRY_ALIYUNCS}/${NAME_SPACE}/$1"
	sudo docker rmi  ${REGISTRY_ALIYUNCS}/${NAME_SPACE}/$1
}

#while read line
#do
#    #echo $line;
#    REPO_IMAGE=`echo $line | sed "s/\ //"`
#    BASE_NAME=`basename $REPO_IMAGE`
#	echo $imageName
#	pull_and_rename $BASE_NAME $REPO_IMAGE 
#
#done < ./images.list

for REPO_IMAGE in ${images[@]} ; do
    #echo $line;
    #REPO_IMAGE=`echo $line | sed "s/\ //"`
    BASE_NAME=`basename $REPO_IMAGE`
	echo $imageName
	pull_and_rename $BASE_NAME $REPO_IMAGE 
done


